Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CCR] Added HLRC support for pause follow API #35216

Merged
merged 9 commits into from
Nov 7, 2018

Conversation

martijnvg
Copy link
Member

This change also includes the docs for hlrc pause follow API.
I picked a simple api to get the hlrc work started for ccr.

Relates to #33824

/cc @hub-cap

@martijnvg martijnvg changed the title [CCR] Added support for pause follow API [CCR] Added HLRC support for pause follow API Nov 2, 2018
@jasontedor jasontedor requested review from hub-cap and removed request for jasontedor November 2, 2018 19:30

import java.io.IOException;

public final class PauseFollowResponse extends AcknowledgedResponse {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reused AcknowledgedResponse from rollup. If we are ok with that then maybe we should move it to another package (o.e.client.common)?

Also many APIs have exactly this same response (acknowledged field). So maybe we can change AcknowledgedResponse to be a concrete class (but still allowing subclasses to change the field name), so that for this API and others we can directly use AcknowledgedResponse class instead of introducing a subclass for each API.

Copy link
Contributor

@hub-cap hub-cap Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#34623 (review)

Id be perfectly happy with you moving it to the core package. Re that link and the review in it, I had suggested that exactly to the author. It looks like i forgot to have him remove abstract from the class, so feel free to do that too!

edit, suggested that exactly == we modified the code such that anyone can override the acknowledged field name, so it could be strings like submitted/deleted in the rollups code.

Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than the comment about the common AcknowledgedResponse, just a super nit. Id like to see it again after you move the AcknowledgedResponse

@@ -786,7 +786,8 @@ public void testApiNamingConventions() throws Exception {
apiName.startsWith("graph.") == false &&
apiName.startsWith("migration.") == false &&
apiName.startsWith("security.") == false &&
apiName.startsWith("index_lifecycle.") == false) {
apiName.startsWith("index_lifecycle.") == false &&
apiName.startsWith("ccr.") == false){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space between false){

@martijnvg
Copy link
Member Author

@hub-cap I've updated the PR.

Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits, I dont need to see it again.

static Request pauseFollow(PauseFollowRequest pauseFollowRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPart(pauseFollowRequest.getFollowerIndex())
.addPathPartAsIs("_ccr/pause_follow")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.addPathPartAsIs("_ccr", "pause_follow")


import java.io.IOException;

public class AcknowledgedResponseResponseTests extends AbstractXContentTestCase<AcknowledgedResponse> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, im not sure we need the toXContent in AcknowledgedResponse, can we make this test look like the other tests that use AbstractXContentTestCase.xContentTester, and remove the toXContent from the AcknowledgedResponse.

Also, I think this class name has one too many Response's in its name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure we need the toXContent in AcknowledgedResponse, can we make this test look like the other tests that use AbstractXContentTestCase.xContentTester, and remove the toXContent from the AcknowledgedResponse.

Agreed, there is no need for the response classes to serialize themselves. We just need them to be parsed from xcontent to java objects. I made this change but then realized that I then also need to change the StartRollupJobResponse, PutRollupJobResponse and StartRollupJobResponse response classes and their test. So I will do that in a follow up change if that is ok with you.

@martijnvg martijnvg merged commit 021f805 into elastic:master Nov 7, 2018
martijnvg added a commit that referenced this pull request Nov 7, 2018
* Moved `AcknowledgedResponse` to core package
* Made AcknowledgedResponse not abstract and provided a default parser,
so that in cases when the field name is not overwritten then there
is no need for a subclass.

Relates to #33824
jasontedor added a commit to martijnvg/elasticsearch that referenced this pull request Nov 8, 2018
* master: (24 commits)
  Replicate index settings to followers (elastic#35089)
  Rename RealmConfig.globalSettings() to settings() (elastic#35330)
  [TEST] Cleanup FileUserPasswdStoreTests (elastic#35329)
  Scripting: Add back lookup vars in score script (elastic#34833)
  watcher: Fix integration tests to ensure correct start/stop of Watcher (elastic#35271)
  Remove ALL shard check in CheckShrinkReadyStep (elastic#35346)
  Use soft-deleted docs to resolve strategy for engine operation (elastic#35230)
  [ILM] Check shard and relocation status in AllocationRoutedStep (elastic#35316)
  Ignore date ranges containing 'now' when pre-processing a percolator query (elastic#35160)
  Add a frozen engine implementation (elastic#34357)
  Put a fake allocation id on allocate stale primary command (elastic#34140)
  [CCR] Enforce auto follow pattern name restrictions (elastic#35197)
  [ILM] rolling upgrade tests (elastic#35328)
  [ML] Add Missing data checking class (elastic#35310)
  Apply `ignore_throttled` also to concrete indices (elastic#35335)
  Make version field names more meaningful  (elastic#35334)
  [CCR] Added HLRC support for pause follow API (elastic#35216)
  [Docs] Improve Convert Processor description (elastic#35280)
  [Painless] Removes extraneous compile method (elastic#35323)
  [CCR] Fail with a better error if leader index is red (elastic#35298)
  ...
pgomulka pushed a commit to pgomulka/elasticsearch that referenced this pull request Nov 13, 2018
* Moved `AcknowledgedResponse` to core package
* Made AcknowledgedResponse not abstract and provided a default parser,
so that in cases when the field name is not overwritten then there
is no need for a subclass.

Relates to elastic#33824
@jpountz jpountz removed the :Distributed/CCR Issues around the Cross Cluster State Replication features label Jan 29, 2019
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants